package Utils;

import javax.swing.ImageIcon;
import javax.swing.JButton;



/**
 * @author andreana@lu.unisi.ch
 */
@SuppressWarnings("serial")


public final class RolloverButton extends JButton{
	private ImageIcon ico;

	/**
	 * RolloverButton constructor takes a text String, and two String which describe the path to a picture.
	 * In normal state, the button has the aspect of the first picture. When clicked, the button look like the 
	 * second image
	 * @param text of the button
	 * @param icon up
	 * @param icon down (pressed)
	 */
	public RolloverButton(final String textOfButton, final String nameOfIconUp, final String nameOfIconDown){
		this.setText(textOfButton);
		ico = new ImageIcon("images/" + nameOfIconUp);
		this.setIcon(ico);
		ico = new ImageIcon("images/" + nameOfIconDown);
		this.setPressedIcon(ico);
		this.setBorderPainted(false);
		this.setContentAreaFilled(false);
		this.setContentAreaFilled(false);
		this.setVisible(true);
	}
}
